package cook

class Dish {


	String name
	BigDecimal price	
	List ingredientItems
	
	static hasMany		= [dishComponents: DishComponent,ingredientItems: IngredientItem]	
	
    static mapping = {
    }
    
	static constraints = {
    }
	
	public BigDecimal getCost(){
		BigDecimal cost = 0
		dishComponents.each{
			cost += it.cost
		}
		ingredientItems.each{
			cost += it.cost
		}
		return cost
	}

	public String toString() {
		return name;
	}
}
